class Solution {
public:
    vector<int> findColumnWidth(vector<vector<int>>& grid) {
        int m = grid[0].size();
        vector<int>ans(m, 0);
        int n = grid.size();
        for (int i = 0; i < m; i++) {
            int ma = 0;
            for (int j = 0; j < n; j++) {
                int z = 0;
                int x = grid[j][i];
                if (x <= 0) {
                    z = 1;
                    x = -x;
                }
                while (x) {
                    z++;
                    x /= 10;
                }
                ma = max(ma, z);
            }
            ans[i] = ma;
        }
        return ans;
    }
};